package com.cherish.meeting.db.mapper;

import com.cherish.meeting.db.entity.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2021-03-02
 */
public interface UserInfoMapper {

    @Select(
            "select * from user_info where openid = #{openid}"
    )
    UserInfo selectByOpenid(String openid);

    @Insert(
            "insert into user_info " +
                    "(openid,name,mobile) " +
                    "values (#{openid},#{name},#{mobile})"
    )
    void insert(UserInfo userInfo);

    @Update(
            "update user_info set " +
                    "name = #{name}, mobile = #{mobile} " +
                    "where openid = #{openid}"
    )
    void updateByOpenId(UserInfo userInfo);
}
